<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <title><{config_item('manager_title')}></title>
    <link href="/public/H-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link href="/public/H-ui/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
    <link href="/public/H-ui/hui-iconfont/iconfont.css" rel="stylesheet" type="text/css">
</head>
<body>
<div>
    <form action="" method="post" class="form form-horizontal" id="add" enctype="multipart/form-data">
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>店铺名称：</label>
            <div class="formControls col-3">
                <input type="text" class="input-text" value="" name="shop_name" datatype="*" nullmsg="请输入店铺名称！">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>店铺logo：</label>
            <div class="formControls col-3">
                <a href="<{$item.logo}>" target="_blank"><img src="<{$item.logo}>" width="50" <{if $item.logo==''}>style="display: none;"<{/if}>></a>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>电话：</label>
            <div class="formControls col-3">
                <input type="text" class="input-text" value="" name="tel" datatype="*" nullmsg="请输入电话！">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>邮箱：</label>
            <div class="formControls col-3">
                <input type="text" class="input-text" value="" name="email" datatype="e" errormsg="邮箱格式错误！">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>营业执照：</label>
            <div class="formControls col-3">
                <a href="<{$item.business_license}>" target="_blank"><img src="<{$item.business_license}>" width="50" <{if $item.business_license==''}>style="display: none;"<{/if}>></a>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>省市区：</label>
            <div class="formControls col-5">
                <span class="select-box" style="width: 31%;">
				<select name="prov" class="select" onchange="area_list('city',this.value);" datatype="*" nullmsg="请选择省！">
                </select>
				</span>
                <span class="select-box" style="width: 31%;">
				<select name="city" class="select" onchange="area_list('area',this.value);" datatype="*" nullmsg="请选择市！">
                </select>
				</span>
                <span class="select-box" style="width: 31%;">
				<select name="area" class="select" datatype="*" nullmsg="请选择区！">
                </select>
				</span>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>地址：</label>
            <div class="formControls col-3">
                <input type="text" class="input-text" value="" name="address" datatype="*" nullmsg="请输入地址！">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-2"><span class="c-red">*</span>店铺简介：</label>
            <div class="formControls col-6">
                <textarea name="desc" cols="" rows="" class="textarea"  placeholder="店铺简介" datatype="*1-100" dragonfly="true" nullmsg="店铺简介不能为空！" onKeyUp="textarealength(this,100)"></textarea>
                <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
            </div>
        </div>
    </form>
</div>
</div>
<script type="text/javascript" src="/public/js/jquery.js"></script>
<script type="text/javascript" src="/public/js/validform.js"></script>
<script type="text/javascript" src="/public/js/layer/layer.js"></script>
<script type="text/javascript" src="/public/js/form.js"></script>
<script type="text/javascript" src="/public/H-ui/js/H-ui.js"></script>
<script type="text/javascript" src="/public/H-ui/js/H-ui.admin.js"></script>
<{ajax_upload()}>
<script type="text/javascript">
    $(function(){
        //验证表单
        $.Tipmsg.r=null;
        $("#add").Validform({
            tiptype:function(msg){
                layer.msg(msg);
            },
            tipSweep:true,
            ajaxPost:true,
            callback:function(data){
                if(data.status=="y"){
                    layer.msg('保存成功');
                    setTimeout('layer_close()',1500);
                }
            }
        });

        //省市区回填
        area_list('prov', 0 <{if $item.prov!=''}>,<{$item.prov}><{/if}>);//省份选择
        <{if $item.city!='' && $item.prov!=''}>
            area_list('city', <{$item.prov}>, <{$item.city}>);//市
        <{/if}>
        <{if $item.area!='' && $item.city!=''}>
            area_list('area', <{$item.city}>, <{$item.area}>);//区
        <{/if}>
        //表单回填
        var formObj = new Form();
        formObj.init(<{ch_json_encode($item)}>);
    })
    //添加图片展示
    function show_upload(spec_pic, url){
        $("#"+spec_pic).parent().find('img').attr('src',url);
        $("#"+spec_pic).parent().find('img').show();
        $("#"+spec_pic).parent().find('a').attr('href',url);
        $("#"+spec_pic).parent().find('[type="hidden"]').val(url);
    }
    //地区加载area_type 选择框名称 parent_id 上级id default_id默认id
    function area_list(area_type, parent_id, default_id){
        $.ajax({
            type:"POST",
            url: '<{site_url("/api/area/get_list")}>',
            data: 'parent_id='+parent_id+'&default_id='+default_id,
            dataType:"html",
            success: function(data){
                $('[name="'+area_type+'"]').html(data);
            }
        });
    }
</script>
</body>
</html>